// 浏览器日志封装工具
// 用法：log.info('msg', obj), log.error('err', errObj)

const PREFIX = "[BigScreen]"; // 可自定义前缀

function formatArgs(args: any[]) {
  const time = new Date().toISOString();
  return [PREFIX, time, ...args];
}

const log = {
  log: (...args: any[]) => {
    console.log(...formatArgs(args));
  },
  info: (...args: any[]) => {
    console.info(...formatArgs(args));
  },
  warn: (...args: any[]) => {
    console.warn(...formatArgs(args));
  },
  error: (...args: any[]) => {
    console.error(...formatArgs(args));
  },
};

export default log;
